diff options
| author | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
| commit | 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch) | |
| tree | b9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/app/(main)/teams/[teamId]/TeamMemberEditButton.tsx | |
| download | umami-main.tar.xz umami-main.zip | |
Created from https://vercel.com/new
Diffstat (limited to 'src/app/(main)/teams/[teamId]/TeamMemberEditButton.tsx')
| -rw-r--r-- | src/app/(main)/teams/[teamId]/TeamMemberEditButton.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/app/(main)/teams/[teamId]/TeamMemberEditButton.tsx b/src/app/(main)/teams/[teamId]/TeamMemberEditButton.tsx new file mode 100644 index 0000000..f75b6d1 --- /dev/null +++ b/src/app/(main)/teams/[teamId]/TeamMemberEditButton.tsx @@ -0,0 +1,46 @@ +import { useToast } from '@umami/react-zen'; +import { useMessages, useModified } from '@/components/hooks'; +import { Edit } from '@/components/icons'; +import { DialogButton } from '@/components/input/DialogButton'; +import { TeamMemberEditForm } from './TeamMemberEditForm'; + +export function TeamMemberEditButton({ + teamId, + userId, + role, + onSave, +}: { + teamId: string; + userId: string; + role: string; + onSave?: () => void; +}) { + const { formatMessage, labels, messages } = useMessages(); + const { toast } = useToast(); + const { touch } = useModified(); + + const handleSave = () => { + touch('teams:members'); + toast(formatMessage(messages.saved)); + onSave?.(); + }; + + return ( + <DialogButton + icon={<Edit />} + title={formatMessage(labels.editMember)} + variant="quiet" + width="400px" + > + {({ close }) => ( + <TeamMemberEditForm + teamId={teamId} + userId={userId} + role={role} + onSave={handleSave} + onClose={close} + /> + )} + </DialogButton> + ); +} |